<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<%@ include file="/common/grid/jqGrid.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="">
	<meta http-equiv="description" content="This is my page">
	<base target="_self" />
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'修改选项事件'}]"/>
    			<jsp:param name="width" value="50%"/>
    		</jsp:include>
    		
    		<s:hidden name="io.id" id="ioId"></s:hidden>
    		
    		<table cellspacing="1" cellpadding="3" bgcolor="#CCCCCC" width="98%">
    			<tr bgcolor="#FFFFFF">
    				<td width="20%" class="label" align="right">
    					焦点事件：
    				</td>
    				<td width="80%" align="left">
   						<s:textarea name="io.focusEvent" id="focusEvent" cssStyle="width:98%; height:200px;"></s:textarea>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td class="label" align="right">
    					输入事件：
    				</td>
    				<td align="left">
    					<s:textarea name="io.keyEvent" id="keyEvent" cssStyle="width:98%; height:200px;"></s:textarea>
    				</td>
    			</tr>
    		</table>
    		
    		<table width="98%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="保存" class="btn" onclick="saveThis()" />
    				</td>
    			</tr>
    		</table>
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function saveThis()
    {
    	var focusEvent = $('#focusEvent');
    	var keyEvent = $('#keyEvent');
    	if(focusEvent.val().length > 2000)
    	{
    		showMsg('焦点事件不能超过2000字。', function(){focusEvent.focus();});
    		return;
    	}
    	if(keyEvent.val().length > 2000)
    	{
    		showMsg('输入事件不能超过2000字。', function(){keyEvent.focus();});
    		return;
    	}
    	if(checkKeyEvent() == false)
        {
			return;
        }
    	showConfirm('修改逻辑可能会导致问卷答案不准确，需要查错。确认保存？', function(v){
    		if(v == true)
			{
		    	ajaxAction('inner/qes/updateItemOption.action', 'post', 'frm', false, function(){
		    		window.close();
		    	});
			}
    	});
    }

    function checkKeyEvent()
    {
        var keyEvent = $('#keyEvent');
        if(keyEvent.val().indexOf('.toEnd') > -1 && keyEvent.val().indexOf('.recover') == -1)
        {
            showMsg('toEnd必须与recover同用。', function(){keyEvent.focus();});
            return false;
        }
        return true;
    }
    </script>
  </body>
</html>
